package com.jingogo.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品实体类
 * 
 * @author jingogo
 * @since 2024-01-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("product")
@Schema(description = "商品实体")
public class Product {

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "商品ID")
    private Long id;

    @NotBlank(message = "商品名称不能为空")
    @Schema(description = "商品名称")
    private String productName;

    @Schema(description = "商品编码")
    private String productCode;

    @Schema(description = "商品分类ID")
    private Long categoryId;

    @Schema(description = "商品描述")
    private String description;

    @Schema(description = "商品图片")
    private String images;

    @NotNull(message = "商品价格不能为空")
    @Schema(description = "商品价格")
    private BigDecimal price;

    @Schema(description = "市场价格")
    private BigDecimal marketPrice;

    @Schema(description = "库存数量")
    private Integer stock;

    @Schema(description = "已售数量")
    private Integer soldCount;

    @Schema(description = "商品状态：0-下架，1-上架")
    private Integer status;

    @Schema(description = "商品类型：1-黄金，2-白银，3-铂金")
    private Integer productType;

    @Schema(description = "重量（克）")
    private BigDecimal weight;

    @Schema(description = "纯度")
    private String purity;

    @Schema(description = "规格")
    private String specification;

    @Schema(description = "排序")
    private Integer sort;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    @TableLogic
    @Schema(description = "是否删除：0-未删除，1-已删除")
    private Integer deleted;
} 